INC=./include
SRC=./src
OBJ=./obj
LIB=./lib

CC=gcc
CFLAGS= -Wall

MAKEOBJ=$(CC) $(CFLAGS) -o $@ -c $< -I$(INC)

all: $(LIB)/mark_and_sweep.a

$(LIB)/mark_and_sweep.a: $(OBJ)/mark_and_sweep.o
	ar cvr $@ $^
	-ranlib $@

$(OBJ)/%.o: $(SRC)/%.c $(INC)/%.h
	$(MAKEOBJ)

clean:
	rm -f *# *~
	rm -f $(INC)/*# $(INC)/*~
	rm -f $(SRC)/*# $(SRC)/*~
	rm -f $(OBJ)/*
	rm -f $(LIB)/*

.PHONY: all clean